local function get_mode()
	local mode = vim.fn.mode()
	if mode == "n" then
		return "Normal"
	elseif mode == "v" then
		return "Visual"
	elseif mode == "V" then
		return "Visual Line"
	elseif mode == "" then
		return "Visual Block"
	elseif mode == "i" then
		return "Insert"
	elseif mode == "R" then
		return "Replace"
	else
		return mode
	end
end

vim.api.nvim_create_autocmd({ "ModeChanged" }, {
	pattern = "*",
	callback = function()
		local win_id = vim.api.nvim_eval([[win_getid()]]) --获取当前window id
		vim.wo[win_id].statusline = get_mode().."|%f%m%=%S|%l:%p|" .. vim.o.encoding .. "|%y" -- 使用 setlocal 针对窗口设置本地化配置
	end,
})
-- vim.opt.showcmd = true
vim.o.showcmdloc = "statusline"
vim.o.cmdheight = 0
-- vim.opt.laststatus = 2
vim.o.statusline = get_mode().."|%f%m%=%S|%l:%p|" .. vim.o.encoding .. "|%y"
